<!DOCTYPE html>
<html lang="en"><!-- InstanceBegin template="/Templates/MainTemplate.dwt" codeOutsideHTMLIsLocked="false" -->
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
<!-- #BeginEditable "doctitle" -->
<title>Command patern for calling services</title>  
<!-- #EndEditable -->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
    <!-- Bootstrap core CSS -->
     <link rel="stylesheet" href="css/bootstrap.min.css">   

    <!-- Custom styles for this template -->
    <link href="css/starter-template.css" rel="stylesheet">

   <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->    
  </head>
<body>
 <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="index.html">Jdon Framework</a>
        </div>
        <div class="collapse navbar-collapse">
          <ul class="nav navbar-nav">
                <li class="active"><a href="index.html">Home</a></li>
               <li><a href="https://sourceforge.net/projects/jdon/files/">Download</a></li>
               <li><a href="doc.htm" >Document</a></li>
               <li><a href="quickconf.html">Qucik Start</a> </li>
               <li><a href="examples.html">Examples</a></li>
               <li ><a href="https://github.com/banq/jdonframework">Github</a></li>
               <li><a href="articles.html">Articles</a></li>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </div>
    

    <div class="container">
     <div class="starter-template">     
    
 <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">  
  <tr>     
    <td bgcolor="#FFFFFF"  valign="top" align="left">

                  
				<!-- #BeginEditable "main" --> 
                  <p>　　</p>
                  <H3> Command patern for calling services</H3>
                  <H3>This function is like the ActionController of Ruby on Rails， the function  handles incoming requests from the user's browser and routes   them to the correct method of a <strong>service</strong> class , not a controller class such as Struts's DispatchAction. </H3>
                  <H3><img src="images/serviceAction.jpg" alt=" " width="421" height="315"></H3>
                  <p>how to implements? three steps:</p>
                  <p><strong>First step</strong>: configure your struts-config.xml:</p>
                  <TABLE cellSpacing=1 cellPadding=1 width="100%" bgColor=#cccccc border=0>
                    <TBODY>
                      <TR>
                        <TD><P>&lt;action path="/aaa" type="<strong>com.jdon.strutsutil.ForwardAction</strong>"　name="aForm" scope="request"validate="false"&gt;</P>
                            <P>&lt;forward name="<strong>xxxxx</strong>" path="/xxx.jsp"/&gt;</P>
                          <P>&lt;/action&gt;</P></TD>
                      </TR>
                    </TBODY>
                  </TABLE>
                  <p>com.jdon.strutsutil.ForwardAction is the a class of jdon framework, <strong>xxxxx</strong> is your browser url parameter. </p>
                  <p><strong>Second Step</strong>: tell jdon framework:you will call which service(the name of the JavaBeans) :</p>
                  <TABLE cellSpacing=1 cellPadding=1 width="100%" bgColor=#cccccc border=0>
                    <TBODY>
                      <TR>
                        <TD><P>&lt;model key="primary key of your model" class ="your model class"&gt;<BR>
                          &lt;actionForm name="aForm"/&gt;<BR>
                          &lt;handler&gt;<BR>
                          &lt;service ref="testService" /&gt; &lt;!--the name of  the JavaBeans--&gt;<BR>
                          &lt;/handler&gt;<BR>
                          &lt;/model&gt;</P>
                            <P>&lt;pojoService name="testService" 　　　　 <BR>
                              class="com.jdon.framework.test.service.TestServicePOJOImp"/&gt;</P>
                          <P></P></TD>
                      </TR>
                    </TBODY>
                  </TABLE>
                  <P><strong> Last Step</strong>: code your service interface:</P>
                  <TABLE cellSpacing=1 cellPadding=1 width="100%" bgColor=#cccccc border=0>
                    <TBODY>
                      <TR>
                        <TD><P>public interface TestService{<BR>
                          ……<BR>
                          void xxxxx(EventModel em);<BR>
                          ……<BR>
                          }</P>
                            <P></P></TD>
                      </TR>
                    </TBODY>
                  </TABLE>
                  <hr>
                  <p>&nbsp;</p>
                   <!-- #EndEditable -->
                 
			  	
          </td>
		  <td width="340" valign="top"  bgcolor="#FFFFD7"> 
          <div class="adsensf" id="vgad336x280">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- 页上左336 -->
<ins class="adsbygoogle"
     style="display:inline-block;width:336px;height:280px"
     data-ad-client="ca-pub-7573657117119544"
     data-ad-slot="6751585519"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- 页上左336 -->
<ins class="adsbygoogle"
     style="display:inline-block;width:336px;height:280px"
     data-ad-client="ca-pub-7573657117119544"
     data-ad-slot="6751585519"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>         
 </td>
  </tr>
</table>


<table width="100%" border="0" cellspacing="0" cellpadding="0" height="2" bgcolor="#000000"  align="center">
              <tr>
                <td></td>
              </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td height="20" bgcolor="#CAC9BB" align="center">
  
  </td>
</tr>
</table>
 </div>
</div><!-- /.container -->

<!-- InstanceBeginEditable name="EditRegion3" --><!-- InstanceEndEditable -->
        <script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
		<script src="js/bootstrap.min.js"></script>
<!-- AddThis Smart Layers BEGIN -->
<!-- Go to http://www.addthis.com/get/smart-layers to customize -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-52c4b79515624135"></script>
<script type="text/javascript">
  addthis.layers({
    'theme' : 'transparent',
    'share' : {
      'position' : 'left',
      'numPreferredServices' : 5
    },  
    'whatsnext' : {},  
    'recommended' : {} 
  });
</script>
<!-- AddThis Smart Layers END -->    
</body>
<!-- InstanceEnd --></html>
